<template>
	<view class="content col">
		<view class="row_wrap1 row">
			{{hospital}}
		</view>
		<view class="row_wrap2 row_between">
			<view class="row-item">
				{{name}}
			</view>
			<view class="row-item">
				{{department}}
			</view>
			<view class="row-item">
				{{title}}
			</view>
		</view>
		<view class="row_wrap3">
			<image :src="qrImage" mode="aspectFill"></image>
		</view>
		<view class="row_wrap4">
			扫描上方二维码，向医生一对一咨询
		</view>

	</view>
</template>

<script>
	import { BASE_URL, qrcode,hcp } from '@/utils/api';
	export default {
		data() {
			return {
				type: '',
				id: '10',
				qrImage: '',
				name: '',
				hospital: '复旦大学附属上海市第五人民医院',
				department: '小儿内科',
				title: '副主任'
			};
		},
		onLoad(opt) {
			uni.setNavigationBarTitle({
			　　title:'咨询医生'
			})
			this.id = opt.hcp?opt.hcp:10;
			
			this.qrcode();
			this.hcp();
		},
		methods: {
			async hcp(){
				let res = await hcp(this.id);
				if(res.status == 0){
					this.name = res.data.name;
					this.hospital = res.data.hospital;
					this.department = res.data.department;
					this.title = res.data.title;
				}
			},
			async qrcode(){
				uni.showLoading();
				let res = await qrcode(this.id);
				if(res.status == 0){
					let base64Data = res.data;
					this.qrImage = base64Data;
					uni.hideLoading();
					console.log(this.qrImage);
				}
			}
		}
	}
</script>

<style lang="scss">
	page {
		background: #F4F4F4;
	}

	.content {
		margin: 100upx 65upx 191upx 65upx;
		background: #FFFFFF;
		height: 915upx;

		.row_wrap1 {
			height: 32upx;
			color: rgba(173, 133, 252, 1);
			font-size: 34upx;
			margin-top: 101upx;
		}

		.row_wrap2 {
			height: 32upx;
			width: 382upx;
			font-size: 34upx;
			margin-top: 39upx;

			.row-item {
				line-height: 1.0;
			}
		}

		.row_wrap3 image {
			width: 339upx;
			height: 339upx;
			margin-top: 39upx;
		}

		.row_wrap4 {
			line-height: 1.0;
			margin-top: 42upx;
			color: rgba(153, 153, 153, 1);
			font-size: 24upx
		}

		.row_wrap5 {
			line-height: 1.5;
			margin-top: 39upx;
			color: rgba(153, 153, 153, 1);
			font-size: 24upx;
			width: 450upx;
		}
	}

	/* 底部分享 */
	.uni-share {
		background: #fff;
	}

	.uni-share-title {
		line-height: 60upx;
		font-size: 24upx;
		padding: 15upx 0;
		text-align: center;
	}

	.uni-share-content {
		display: flex;
		flex-wrap: wrap;
		padding: 15px;
	}

	.uni-share-content-box {
		display: flex;
		flex-direction: column;
		align-items: center;
		width: 25%;
		box-sizing: border-box;
	}

	.uni-share-content-image {
		display: flex;
		justify-content: center;
		align-items: center;
		width: 60upx;
		height: 60upx;
		overflow: hidden;
		border-radius: 10upx;
	}

	.uni-share-content-image .image {
		width: 100%;
		height: 100%;
	}

	.uni-share-content-text {
		font-size: 26upx;
		color: #333;
		padding-top: 5px;
		padding-bottom: 10px;
	}

	.uni-share-btn {
		height: 90upx;
		line-height: 90upx;
		border-top: 1px #f5f5f5 solid;
		text-align: center;
		color: #666;
	}
</style>
